
<!--
All rights Reserved, Designed By www.youyacao.com
@Description:管理员列表
@author:成都市一颗优雅草科技有限公司
@version V4.2
注意：本前端源码遵循 MIT开源协议本内容仅限于个人参考，禁止用于其他的商业用途
需要商业用途或者定制开发等可访问songshu.youyacao.com   联系QQ:422108995 23625059584
开源gitee地址：https://gitee.com/youyacao/songshu-video-page
 -->
<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-lx-calendar"></i> 管理员管理
        </el-breadcrumb-item>
        <el-breadcrumb-item>管理员日志</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <el-table
        :data="tableData"
        class="table"
        ref="multipleTable"
        header-cell-class-name="table-header"
      >
        <el-table-column prop="uid" label="用户ID" align="center"></el-table-column>
        <el-table-column label="动作" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.type=='error'" :style="{color:'red'}">{{scope.row.action}}</span>
            <span v-if="scope.row.type=='login'" :style="{color:'green'}">{{scope.row.action}}</span>
            <span v-if="scope.row.type=='logout'" :style="{color:'blue'}">{{scope.row.action}}</span>
            <span v-if="scope.row.type=='info'" :style="{color:'black'}">{{scope.row.action}}</span>
          </template>
        </el-table-column>
         <el-table-column prop="request_data" inline="true" label="请求数据" align="center"></el-table-column>
        <el-table-column prop="time" label="时间" align="center"></el-table-column>
        <el-table-column prop="ip" label="IP" align="center"></el-table-column>

      </el-table>
      <div class="pagination">
        <el-pagination
          background
          layout="total, prev, pager, next"
          :current-page="query.page"
          :page-size="query.pageSize"
          :total="total"
          @current-change="handlePageChange"
        ></el-pagination>
      </div>
    </div>

  </div>
</template>

<script>
export default {
  name: "basetable",
  data() {
    return {
      query: {
        type: "login",
        page: 1,
        pageSize: 10
      },
      tableData: [],
      multipleSelection: [],
      delList: [],
      editVisible: false,
      total: 0,
      form: {},
      idx: -1,
      id: -1
    };
  },
  created() {
    this.getData();
  },
  methods: {
    // 获取 easy-mock 的模拟数据
    getData() {
      this.$api.user.log(this.query).then(res => {

        this.tableData = res.data;
        this.total = res.total || 0;
      });
    },
    // 分页导航
    handlePageChange(val) {
      this.$set(this.query, "page", val);
      this.getData();
    },

  }
};
</script>

<style scoped>
.handle-box {
  margin-bottom: 20px;
}

.handle-select {
  width: 120px;
}

.handle-input {
  width: 300px;
  display: inline-block;
}
.table {
  width: 100%;
  font-size: 14px;
}
.red {
  color: #ff0000;
}
.mr10 {
  margin-right: 10px;
}
.table-td-thumb {
  display: block;
  margin: auto;
  width: 40px;
  height: 40px;
}
</style>
